<template>
  <div class="container">
    <topTitle
      :titleText="titleText"
      @gobackTriser="goBack"
      :back="back"
    ></topTitle>
    <div class="mainCon">
      <el-row>
        <el-col :span="24" class="subTitleBox">
          <div class="secondaryTitle secondaryTitleTheme">任务详情信息</div>
        </el-col>
      </el-row>
      <table cellspacing="0" cellpadding="0" class="detailTable">
        <tr>
          <td class="title">任务批次</td>
          <td class="rightInfo">{{ task.jobBatch }}</td>
          <td class="title">任务编号</td>
          <td class="rightInfo">{{ task.jobNumber }}</td>
        </tr>
        <tr>
          <td class="title">任务模式</td>
          <td class="rightInfo">{{ task.jobMothedDesc }}</td>
          <td class="title">巡查类型</td>
          <td class="rightInfo">{{ task.typeDesc }}</td>
        </tr>
        <tr>
          <td class="title">巡查模板</td>
          <td class="rightInfo">{{ task.templateName }}</td>
          <td class="title">单位类型</td>
          <td class="rightInfo">{{ task.fieldTypeDesc }}</td>
        </tr>
        <tr>
          <td class="title">单位名称</td>
          <td colspan="3" class="rightInfo">{{ task.companyName }}</td>
        </tr>
        <tr>
          <td class="title">任务人员</td>
          <td colspan="3" class="rightInfo">{{ task.jobUserName }}</td>
        </tr>
        <tr>
          <td class="title">任务状态</td>
          <td class="rightInfo">{{ task.statusDesc }}</td>
          <td class="title">任务期限</td>
          <td class="rightInfo">{{ task.endDate }}</td>
        </tr>
        <tr>
          <td class="title">创建时间</td>
          <td class="rightInfo">{{ task.createTime }}</td>
          <td class="title">完成日期</td>
          <td class="rightInfo">{{ task.completeDate }}</td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
export default {
  name: 'taskDetail',
  data() {
    return {
      titleText: '任务详情',
      back: true,
      taskId: '',
      task: {},
    }
  },
  created() {
    this.taskId = this.$route.query.taskId
    this.getDetail()
  },
  methods: {
    goBack() {
      this.$router.push('/home/patrolTask/patrolTaskList')
      this.$store.commit('GOBACK_NAME', {
        oldUrl: '/home/patrolTask/patrolTaskList',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    getDetail() {
      this.axios({
        method: 'post',
        url: 'api-gov/ipqcjob/expand/findbyid',
        data: {
          id: this.taskId,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.task = response.data.result
          } else {
            this.$message({
              type: 'error',
              message: response.data.errorMsg,
            })
            this.btnChangeEnable = false
          }
        })
        .catch((error) => {})
    },
  },
}
</script>

<style scoped lang="less">
.mainCon {
  top: 198px;
  padding: 24px;
  padding-top: 0;
}
.subTitleBox {
  padding: 24px;
  padding-left: 0;
}
</style>
